wordpress get user by id

47

get_the_id wordpress -

function get_the_ID() { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid
    $post = get_post();
    return ! empty( $post ) ? $post->ID : false;
}

wordpress get user by id -

$user_obj = get_user_by('id', 1);

wordpress get user id by email -

$user = get_user_by( 'email', '[email protected]' );
$userId = $user->ID;

Comments

Submit
0 Comments